#ifndef CAPTURER_H
#define CAPTURER_H

#include <QObject>

#include <QImage>

#include <opencv/highgui.h>
#include <opencv/cv.h>

class Capturer : public QObject
{
    Q_OBJECT
public:
    explicit Capturer(QObject *parent = 0);
    Capturer(int index);
    Capturer(QString filename);

    static Capturer* createCameraCapturer(int index);

signals:
    void capturedNewImage(QImage image);
    void capturedNewImage(IplImage* image);
    void start();

public slots:
    void capture();
    void startCapture();


private slots:
     void captureNextFrame();

private:
    CvCapture* capturer;
    IplImage* currentFrame;
    bool shouldCapture;

};

#endif // CAPTURER_H
